babl_log upgade
authorØyvind Kolås <ok@src.gnome.org>
Sat, 27 Aug 2005 19:47:20 +0000 (19:47 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Sat, 27 Aug 2005 19:47:20 +0000 (19:47 +0000)
16 files changed:
ChangeLog
babl/babl-component.c
babl/babl-conversion.c
babl/babl-db.h
babl/babl-fish.c
babl/babl-format.c
babl/babl-image.c
babl/babl-internal.h
babl/babl-introspect.c
babl/babl-memory.c
babl/babl-model.c
babl/babl-pixel-format.c
babl/babl-type.c
babl/babl-util.c
babl/base/type-u8.c
tests/babl_class_name.c

index bb49a9f788b60751b9eff5248da986844682b3dc..e289389a8fd76a72911145424c6b6c508b81e88d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2005-08-27  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl-component.c: (babl_component_new):
+       * babl/babl-conversion.c: (conversion_new), (babl_conversion_new),
+       (babl_conversion_process):
+       * babl/babl-db.h:
+       * babl/babl-fish.c: (babl_conversion_find), (babl_fish),
+       (babl_fish_reference_process), (babl_fish_process), (babl_process):
+       * babl/babl-image.c: (babl_image_from_linear), (babl_image):
+       * babl/babl-internal.h:
+       * babl/babl-introspect.c: (babl_introspect), (model_introspect):
+       * babl/babl-memory.c: (babl_malloc), (babl_strdup), (babl_realloc),
+       (babl_calloc):
+       * babl/babl-model.c: (babl_model_new):
+       * babl/babl-pixel-format.c: (format_new), (babl_format_new):
+       * babl/babl-type.c: (babl_type_new):
+       * babl/babl-util.c: (babl_add_ptr_to_list):
+       * babl/base/type-u8.c:
+       * tests/babl_class_name.c: (test): 
+
+       Made babl_log(...) print the file, line and function by itself.
+
 2005-08-27  Øyvind Kolås  <pippin@gimp.org>
 
        * docs/graphics/Makefile.am: s/INSCAPE/INKSCAPE/
index fd4cef9f4daa646ed694ab4b7ce3dd6f7b1f6767..3724d9683f0a78b12a34bc4450d6ef5ca6faa8bf 100644 (file)
@@ -79,10 +79,10 @@ babl_component_new (const char *name,
       
       if (BABL_IS_BABL (arg))
         {
-          Babl *babl = (Babl*)arg;
-
-          babl_log ("%s(): %s unexpected",
-                    __FUNCTION__, babl_class_name (babl->class_type));
+#ifdef BABL_LOG
+          Babl *babl = (Babl*) arg;
+          babl_log ("%s unexpected", babl_class_name (babl->class_type));
+#endif
         }
       /* if we didn't point to a babl, we assume arguments to be strings */
 
@@ -108,8 +108,7 @@ babl_component_new (const char *name,
       
       else
         {
-          babl_log ("%s(): unhandled parameter '%s' for format '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for format '%s'", arg, name);
           exit (-1);
         }
     }
index 0b2961fd8797c2e4f87fc7b0ed07e9667c06edb5..278dfc751266b1e86ffbc17138c6061849199968 100644 (file)
@@ -63,15 +63,13 @@ conversion_new (const char        *name,
           }
         else if (planar_bit)
           {
-            babl_log ("%s(): planar_bit support not implemented yet",
-                      __FUNCTION__);
+            babl_log ("planar_bit support not implemented yet");
           }
         break;
       case BABL_MODEL:
         if (linear)
           {
-            babl_log ("%s(): linear support for model conversion not supported",
-                      __FUNCTION__);
+            babl_log ("linear support for model conversion not supported");
           }
         else if (planar)
           {
@@ -81,8 +79,7 @@ conversion_new (const char        *name,
           }
         else if (planar_bit)
           {
-            babl_log ("%s(): planar_bit support for model conversion not supported",
-                      __FUNCTION__);
+            babl_log ("planar_bit support for model conversion not supported");
           }
         break;
       case BABL_FORMAT:
@@ -100,18 +97,16 @@ conversion_new (const char        *name,
           }
         else if (planar_bit)
           {
-            babl_log ("%s(): planar_bit support for pixelformat conversion not supported",
-                      __FUNCTION__);
+            babl_log ("planar_bit support for pixelformat conversion not supported");
           }
         break;
       default:
-          babl_log ("%s(): %s unexpected",
-                    __FUNCTION__, babl_class_name (babl->class_type));
+          babl_log ("%s unexpected", babl_class_name (babl->class_type));
         break;
     }
   if (!babl)
     {
-      babl_log ("%s(name='%s', ...): creation failed", __FUNCTION__, name);
+      babl_log ("args=(name='%s', ...): creation failed",  name);
       return NULL;
     }
 
@@ -164,8 +159,7 @@ babl_conversion_new (const char *name,
         {
           if (got_func++)
             {
-              babl_log ("%s(): already got a conversion func, registration of multiple might be possible later\n",
-              __FUNCTION__); 
+              babl_log ("already got a conversion func, registration of multiple might be possible later\n"); 
             }
           linear = va_arg (varg, BablFuncLinear);
         }
@@ -174,8 +168,7 @@ babl_conversion_new (const char *name,
         {
           if (got_func++)
             {
-              babl_log ("%s(): already got a conversion func, registration of multiple might be possible later\n",
-              __FUNCTION__); 
+              babl_log ("already got a conversion func, registration of multiple might be possible later\n"); 
             }
           planar = va_arg (varg, BablFuncPlanar);
         }
@@ -184,8 +177,7 @@ babl_conversion_new (const char *name,
         {
           if (got_func++)
             {
-              babl_log ("%s(): already got a conversion func, registration of multiple might be possible later\n",
-              __FUNCTION__); 
+              babl_log ("already got a conversion func, registration of multiple might be possible later\n"); 
             }
           planar_bit = va_arg (varg, BablFuncPlanarBit);
         }
@@ -208,8 +200,7 @@ babl_conversion_new (const char *name,
         }
       else
         {
-          babl_log ("%s(): unhandled parameter '%s' for format '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for format '%s'", arg, name);
           exit (-1);
         }
     }
@@ -332,8 +323,8 @@ babl_conversion_process (BablConversion *conversion,
                                                         n);
       break;
     default:
-      babl_log ("%s(%s, %p, %p, %li) unhandled conversion type: %s",
-          __FUNCTION__, conversion->instance.name, source, destination, n,
+      babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s",
+           conversion->instance.name, source, destination, n,
           babl_class_name (conversion->instance.class_type));
       break;
   }
index bd4f5007634aef8186b2359427924c20157d546f..8dd08849245e7e185264ea769691b190a21a05f2 100644 (file)
@@ -71,8 +71,7 @@ DB_DEF Babl * db_find    (const char *name)
 
       if (db[0])
         sample_type = babl_class_name (db[0]->class_type);
-      babl_log ("%s(\"%s\"): failed (query performed on a %s database)",
-       __FUNCTION__, name, sample_type);
+      babl_log ("failed (query performed on a %s database)", sample_type);
     }
   return ret;
 }
@@ -118,13 +117,13 @@ db_insert (Babl *babl)
 
   if (collision)
     {
-      if (collision->instance.id == babl->instance.id)
-        babl_log ("%s: conflicting id: existing(%i:'%s') - new(%i:'%s')",
-                __FUNCTION__, collision->instance.id, collision->instance.name,
+      if (!strcmp (collision->instance.name, babl->instance.name))
+        babl_log ("conflicting name: existing(%i:'%s') - new(%i:'%s')",
+                collision->instance.id, collision->instance.name,
                 babl->instance.id, babl->instance.name);
-      else if (!strcmp (collision->instance.name, babl->instance.name))
-        babl_log ("%s: conflicting name: existing(%i:'%s') - new(%i:'%s')",
-                __FUNCTION__, collision->instance.id, collision->instance.name,
+      else if (collision->instance.id == babl->instance.id)
+        babl_log ("conflicting id: existing(%i:'%s') - new(%i:'%s')",
+                collision->instance.id, collision->instance.name,
                 babl->instance.id, babl->instance.name);
       return collision;
     }
@@ -136,7 +135,8 @@ db_insert (Babl *babl)
       new_db = babl_realloc (db, (db_size + DB_INCREMENT_SIZE) * sizeof (BablInstance*));
       if (!new_db)
         {
-          babl_log ("db_insert: unable to reallocate memory, element (%i:'%s') not inserted", babl->instance.id, babl->instance.name);
+          babl_log ("unable to reallocate memory, element (%i:'%s') not inserted",
+                    babl->instance.id, babl->instance.name);
           return NULL;
         }
       db = new_db;
index 9dff7b1f3d14b47e2ab93e38edb4ca86fffe7523..329e15f2608403ee6a4182f0fddfd308eb7edb18 100644 (file)
@@ -108,7 +108,7 @@ BablConversion *babl_conversion_find (void *source,
 
   if (!data.result)
     {
-      babl_log ("%s('%s', '%s'): failed, aborting", __FUNCTION__,
+      babl_log ("args=('%s', '%s'): failed, aborting", 
         data.source->instance.name, data.destination->instance.name);
       exit (-1);
       return NULL;
@@ -170,8 +170,7 @@ babl_fish (void *source,
 
   if (!source_format)
     {
-      babl_log ("%s(%p, %p) source format invalid", 
-         __FUNCTION__, source, destination);
+      babl_log ("args=(%p, %p) source format invalid", source, destination);
     }
 
   if (BABL_IS_BABL (destination))
@@ -186,8 +185,7 @@ babl_fish (void *source,
 
   if (!destination_format)
     {
-      babl_log ("%s(%p, %p) destination format invalid",
-         __FUNCTION__, source, destination);
+      babl_log ("args=(%p, %p) destination format invalid", source, destination);
     }
   
   return babl_fish_reference_new (source_format, destination_format);
@@ -338,8 +336,8 @@ babl_fish_reference_process (Babl      *babl,
   if (BABL_IS_BABL (source) ||
       BABL_IS_BABL (destination))
     {
-      babl_log ("%s(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
-                __FUNCTION__, babl_fish, source, destination, n);
+      babl_log ("args=(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
+                 babl_fish, source, destination, n);
     }
 
   convert_to_double (
@@ -390,7 +388,7 @@ babl_fish_process (Babl *babl,
                    void *destination,
                    long  n)
 {
-  babl_log ("%s(): NYI", __FUNCTION__);
+  babl_log ("NYI");
   return -1;
 }
 
@@ -434,7 +432,7 @@ babl_process (Babl *babl,
        return 0;
     }
 
-  babl_log ("%s(): eek", __FUNCTION__);
+  babl_log ("eek");
   return -1;
 }
 
index fe3406d1746edc566c094e86edb1dd884325bf22..5511290aa72c2390801f491e80b52414484bbf97 100644 (file)
@@ -61,8 +61,7 @@ format_new (const char     *name,
             if (component[j] == model->component[i])
               goto component_found;
           }
-        babl_log ("%s(): matching source component for %s in model %s not found",
-           __FUNCTION__, 
+        babl_log ("matching source component for %s in model %s not found",
            model->component[i]->instance.name, model->instance.name);
         exit (-1);
         component_found:
@@ -150,8 +149,8 @@ babl_format_new (const char *name,
               case BABL_COMPONENT:
                 if (!model)
                   {
-                    babl_log ("%s(): no model specified before component %s",
-                              __FUNCTION__, babl->instance.name);
+                    babl_log ("no model specified before component %s",
+                               babl->instance.name);
                   }
                 component [components] = (BablComponent*) babl;
                 type      [components] = current_type;
@@ -160,8 +159,8 @@ babl_format_new (const char *name,
 
                 if (components>=BABL_MAX_COMPONENTS)
                   {
-                    babl_log ("%s(): maximum number of components (%i) exceeded for %s",
-                              __FUNCTION__, BABL_MAX_COMPONENTS, name);
+                    babl_log ("maximum number of components (%i) exceeded for %s",
+                               BABL_MAX_COMPONENTS, name);
                   }
                 break;
               case BABL_SAMPLING:
@@ -170,8 +169,8 @@ babl_format_new (const char *name,
               case BABL_MODEL:
                   if (model)
                     {
-                    babl_log ("%s(%s): model %s already requested",
-                     __FUNCTION__, babl->instance.name, model->instance.name);
+                    babl_log ("args=(%s): model %s already requested",
+                      babl->instance.name, model->instance.name);
                     }
                   model = (BablModel*)arg;
                   break;
@@ -186,8 +185,8 @@ babl_format_new (const char *name,
               case BABL_FISH:
               case BABL_FISH_REFERENCE:
               case BABL_IMAGE:
-                babl_log ("%s(): %s unexpected",
-                          __FUNCTION__, babl_class_name (babl->class_type));
+                babl_log ("%s unexpected",
+                           babl_class_name (babl->class_type));
                 break;
               case BABL_SKY: /* shut up compiler */
                 break;
@@ -211,8 +210,7 @@ babl_format_new (const char *name,
       
       else
         {
-          babl_log ("%s: unhandled parameter '%s' for format '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for format '%s'", arg, name);
           exit (-1);
         }
     }
index 7e02aabc3b62050f78dd22cf5bb5e876e996d3b9..042b66e19b53e5cee56d65e3b9e19aaf78295fdc 100644 (file)
@@ -135,7 +135,7 @@ babl_image_from_linear (void  *buffer,
           }
         break;
       default:
-        babl_log ("%s(): Eeeek!", __FUNCTION__);
+        babl_log ("Eeeek!");
         break;
     }
 
@@ -182,8 +182,7 @@ babl_image (void *first,
             }
           else
             {
-                babl_log ("%s(): %s unexpected",
-                          __FUNCTION__, babl_class_name (babl->class_type));
+                babl_log ("%s unexpected", babl_class_name (babl->class_type));
                 return NULL;
             }
         }
@@ -203,8 +202,7 @@ babl_image (void *first,
                 
       if (components>=BABL_MAX_COMPONENTS)
         {
-          babl_log ("%s(): maximum number of components (%i) exceeded",
-                    __FUNCTION__, BABL_MAX_COMPONENTS);
+          babl_log ("maximum number of components (%i) exceeded", BABL_MAX_COMPONENTS);
         }
 
       arg = va_arg (varg, char *);
index 277b4b16e64182d1eea3aeec251d6a95d2461bb0..8879c82887cc5a82acd9ed27aba24e182f6eb9f1 100644 (file)
 #include "babl-util.h"
 #include "babl-memory.h"
 #include "babl-classes.h"
+
+/* internal classes */
 #include "babl-conversion.h"
+/* */
 
-#define babl_log(fmt, args...) do {      \
-  fprintf (stdout, "babl: ");            \
-  fprintf (stdout, fmt, args);           \
+#define babl_log(args...) do {      \
+  fprintf (stdout, "%s:%i %s() ", \
+      __FILE__, __LINE__, __FUNCTION__); \
+  fprintf (stdout, args);           \
   fprintf (stdout, "\n");                \
 } while (0)
 
-
 extern int babl_hmpf_on_name_lookups;
 
 #define BABL_DEFINE_EACH(type_name)                           \
@@ -81,19 +84,36 @@ type_name (const char *name)                                  \
   return babl;                                                \
 }
 
+#ifndef BABL_INIT_HOOK
+#define BABL_INIT_HOOK
+#endif
+#ifndef BABL_PRE_INIT_HOOK
+#define BABL_PRE_INIT_HOOK
+#endif
+#ifndef BABL_DESTROY_HOOK
+#define BABL_DESTROY_HOOK
+#endif
+#ifndef BABL_DESTROY_PRE_HOOK
+#define BABL_DESTROY_PRE_HOOK
+#endif
+
 #define BABL_DEFINE_INIT(type_name)                           \
 void                                                          \
 type_name##_init (void)                                       \
 {                                                             \
+  BABL_PRE_INIT_HOOK;                                         \
   db_init ();                                                 \
+  BABL_INIT_HOOK;                                             \
 }
 
 #define BABL_DEFINE_DESTROY(type_name)                        \
 void                                                          \
 type_name##_destroy (void)                                    \
 {                                                             \
+  BABL_DESTROY_PRE_HOOK;                                      \
   db_each (each_##type_name##_destroy, NULL);                 \
   db_destroy ();                                              \
+  BABL_DESTROY_HOOK;                                          \
 }
 
 #define BABL_CLASS_TEMPLATE(type_name)                        \
index 91a2a800c861049dceb7d3d728f8bb516aa95c5f..a933b28b7496f118402221b8513d4118f8ed9fae 100644 (file)
 #include "babl.h"
 #include "babl-internal.h"    /* for babl_log */
 
+#ifdef BABL_LOG
+
 static void sampling_introspect     (Babl *babl);
 static void model_introspect        (Babl *babl);
 static void type_introspect         (Babl *babl);
 static void format_introspect       (Babl *babl);
 static int  each_introspect         (Babl *babl,
                                      void *user_data);
+#endif
 
 void
 babl_introspect (void)
 {
+#ifdef BABL_LOG
   babl_log ("Introspection report%s","");  
   babl_log ("====================================================%s" ,"");  
 
@@ -56,8 +60,10 @@ babl_introspect (void)
   babl_fish_each         (each_introspect, NULL);
 
   babl_log ("%s", "");
+#endif
 }
 
+#ifdef BABL_LOG
 static int list_length (void **list)
 {
   void **ptr;
@@ -112,8 +118,8 @@ model_introspect (Babl *babl)
 
   for (i=0; i< babl->model.components; i++)
     {
-      babl_log ("\t\tindex[%i] = '%s'",
-                i, BABL(babl->model.component[i])->instance.name  );
+      babl_log ("\t\tindex[%i] = '%s'", i,
+         BABL(babl->model.component[i])->instance.name  );
     }
 }
 
@@ -187,3 +193,4 @@ each_introspect (Babl *babl,
     }
   return 0;
 }
+#endif
index 3a7c81bbc466c06194c8c53d2d29e27b98c12c43..ff2026f791f4c2e35a080f8b69c5a83319c890ea 100644 (file)
@@ -60,7 +60,7 @@ babl_malloc (size_t size)
   assert (size); 
   ret = malloc (size + OFFSET);
   if (!ret)
-    babl_log ("%s(%i): failed", __FUNCTION__, size);
+    babl_log ("args=(%i): failed",  size);
 
   BAI(ret + OFFSET)->signature = signature;
   BAI(ret + OFFSET)->size      = size;
@@ -75,7 +75,7 @@ babl_strdup (const char *s)
 
   ret = babl_malloc (strlen (s)+1);
   if (!ret)
-    babl_log ("%s(%s): failed", __FUNCTION__, s);
+    babl_log ("args=(%s): failed",  s);
   strcpy (ret, s); 
 
   strdups++;
@@ -123,7 +123,7 @@ babl_realloc (void   *ptr,
   ret = realloc (BAI(ptr), size + OFFSET);
 
   if (!ret)
-    babl_log ("%s(%p, %i): failed", __FUNCTION__, ptr, size);
+    babl_log ("args=(%p, %i): failed",  ptr, size);
   
   BAI(ret+OFFSET)->signature = signature;
   BAI(ret+OFFSET)->size      = size;
@@ -139,7 +139,7 @@ babl_calloc (size_t nmemb,
   void *ret = babl_malloc (nmemb*size);
 
   if (!ret)
-    babl_log ("%s(%i, %i): failed", __FUNCTION__, nmemb, size);
+    babl_log ("args=(%i, %i): failed",  nmemb, size);
 
   memset (ret, 0, nmemb*size);
 
index 76d0878e711c195d8b8e2a197a60d6a18229bcf8..159e468b788a7af400601889921dfc68384074db 100644 (file)
@@ -91,12 +91,12 @@ babl_model_new (const char *name,
 
                 if (components>=BABL_MAX_COMPONENTS)
                   {
-                    babl_log ("%s(): maximum number of components (%i) exceeded for %s",
-                     __FUNCTION__, BABL_MAX_COMPONENTS, name);
+                    babl_log ("maximum number of components (%i) exceeded for %s",
+                      BABL_MAX_COMPONENTS, name);
                   }
                 break;
               case BABL_MODEL:
-                  babl_log ("%s(): submodels not handled yet", __FUNCTION__);
+                  babl_log ("submodels not handled yet");
                   break;
               case BABL_TYPE:
               case BABL_SAMPLING:
@@ -113,8 +113,7 @@ babl_model_new (const char *name,
               case BABL_FISH:
               case BABL_FISH_REFERENCE:
               case BABL_IMAGE:
-                babl_log ("%s(): %s unexpected",
-                          __FUNCTION__, babl_class_name (babl->class_type));
+                babl_log ("%s unexpected", babl_class_name (babl->class_type));
                 break;
               case BABL_SKY: /* shut up compiler */
                 break;
@@ -128,8 +127,7 @@ babl_model_new (const char *name,
       
       else
         {
-          babl_log ("%s: unhandled parameter '%s' for babl_model '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for babl_model '%s'", arg, name);
           exit (-1);
         }
     }
index fe3406d1746edc566c094e86edb1dd884325bf22..5511290aa72c2390801f491e80b52414484bbf97 100644 (file)
@@ -61,8 +61,7 @@ format_new (const char     *name,
             if (component[j] == model->component[i])
               goto component_found;
           }
-        babl_log ("%s(): matching source component for %s in model %s not found",
-           __FUNCTION__, 
+        babl_log ("matching source component for %s in model %s not found",
            model->component[i]->instance.name, model->instance.name);
         exit (-1);
         component_found:
@@ -150,8 +149,8 @@ babl_format_new (const char *name,
               case BABL_COMPONENT:
                 if (!model)
                   {
-                    babl_log ("%s(): no model specified before component %s",
-                              __FUNCTION__, babl->instance.name);
+                    babl_log ("no model specified before component %s",
+                               babl->instance.name);
                   }
                 component [components] = (BablComponent*) babl;
                 type      [components] = current_type;
@@ -160,8 +159,8 @@ babl_format_new (const char *name,
 
                 if (components>=BABL_MAX_COMPONENTS)
                   {
-                    babl_log ("%s(): maximum number of components (%i) exceeded for %s",
-                              __FUNCTION__, BABL_MAX_COMPONENTS, name);
+                    babl_log ("maximum number of components (%i) exceeded for %s",
+                               BABL_MAX_COMPONENTS, name);
                   }
                 break;
               case BABL_SAMPLING:
@@ -170,8 +169,8 @@ babl_format_new (const char *name,
               case BABL_MODEL:
                   if (model)
                     {
-                    babl_log ("%s(%s): model %s already requested",
-                     __FUNCTION__, babl->instance.name, model->instance.name);
+                    babl_log ("args=(%s): model %s already requested",
+                      babl->instance.name, model->instance.name);
                     }
                   model = (BablModel*)arg;
                   break;
@@ -186,8 +185,8 @@ babl_format_new (const char *name,
               case BABL_FISH:
               case BABL_FISH_REFERENCE:
               case BABL_IMAGE:
-                babl_log ("%s(): %s unexpected",
-                          __FUNCTION__, babl_class_name (babl->class_type));
+                babl_log ("%s unexpected",
+                           babl_class_name (babl->class_type));
                 break;
               case BABL_SKY: /* shut up compiler */
                 break;
@@ -211,8 +210,7 @@ babl_format_new (const char *name,
       
       else
         {
-          babl_log ("%s: unhandled parameter '%s' for format '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for format '%s'", arg, name);
           exit (-1);
         }
     }
index c11d4c45ad0955a1ea55211d485b737119b39d6b..681223166ac298c8f9c06804304889a270c62622 100644 (file)
@@ -84,10 +84,11 @@ babl_type_new (const char *name,
      
       if (BABL_IS_BABL (arg))
         {
+#ifdef BABL_LOG
           Babl *babl = (Babl*)arg;
 
-          babl_log ("%s(): %s unexpected",
-                    __FUNCTION__, babl_class_name (babl->class_type));
+          babl_log ("%s unexpected", babl_class_name (babl->class_type));
+#endif
         }
       /* if we didn't point to a babl, we assume arguments to be strings */
       else if (!strcmp (arg, "id"))
@@ -124,8 +125,8 @@ babl_type_new (const char *name,
       
       else
         {
-          babl_log ("%s(): unhandled parameter '%s' for format '%s'",
-                    __FUNCTION__, arg, name);
+          babl_log ("unhandled parameter '%s' for format '%s'",
+                     arg, name);
           exit (-1);
         }
     }
index 14ceba17c37bcf670ee32b425a0d9c54ed0facda..3d40fe868500034af1379731edd6d4e40895ad7f 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "babl-memory.h"
+#include "babl-internal.h"
 
 static int list_length (void **list)
 {
@@ -52,7 +53,7 @@ babl_add_ptr_to_list (void ***list,
 
   if (!(*list))
     {
-      fprintf (stderr, "%s(): eeek! failed to realloc", __FUNCTION__);
+       babl_log ("failed to realloc");
     }
 
   (*list)[orig_len]=new;
index 59eb4dfd0b5bf0cc989ccaf3dd8ec2692e4ca5ed..a979021291518dc66e095745d96afbf736d21ff1 100644 (file)
@@ -103,7 +103,7 @@ convert_double_##name (void *src,                               \
                             src, dst, src_pitch, dst_pitch, n); \
 }
 
-MAKE_CONVERSIONS (u8,        0.0, 1.0, 0x00, 0xff);
+MAKE_CONVERSIONS (u8,        0.0, (255.0F/256.0F)*1.0, 0x00, 0xff);
 MAKE_CONVERSIONS (u8_luma,   0.0, 1.0, 16, 235);
 MAKE_CONVERSIONS (u8_chroma, 0.0, 1.0, 16, 240);
 
index d411518e4bcecba3a6c24fb380115a787c5bc162..c01115073492b33fde2054e221d5a9ebdd9d9fb2 100644 (file)
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <stdio.h>
 #include "babl.h"
+#include "babl-internal.h"
 
 struct
   {
@@ -56,7 +57,7 @@ test (void)
       if (strcmp (reference[i].name, babl_class_name (reference[i].klass)))
         {
           OK=0;
-          printf ("'%s'!='%s'\n", reference[i].name, babl_class_name (reference[i].klass));
+          babl_log ("'%s'!='%s'\n", reference[i].name, babl_class_name (reference[i].klass));
         }
       i++;
     }